package com.fuint.minio.configurer;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @ClassName : MinIOConfig
 * @Description :
 * @Author : wzq
 * @Date: 2022-01-04 17:02
 */
@Data
@Component
public class MinIOConfig {
    @Value("${minIO.endpoint}")
    private String endpoint;
    @Value("${minIO.access_key}")
    private String accessKey;
    @Value("${minIO.secret_key}")
    private String secretKey;

    /**
     * 注册客户端返回 minioCliient
     */
    @Bean
    public MinioClient minioClient(){
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey,secretKey)
                .build();
    }
}
